package com.hellobike.haxing.modules.wms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hellobike.haxing.modules.wms.entity.DeliveryOrderBox;
import com.hellobike.haxing.modules.wms.mapper.DeliveryOrderBoxMapper;
import com.hellobike.haxing.modules.wms.service.IDeliveryOrderBoxService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: t_wms_delivery_order_box
 * @Author: haxing-boot
 * @Date:   2020-01-14
 * @Version: V1.0
 */
@Service
public class DeliveryOrderBoxServiceImpl extends ServiceImpl<DeliveryOrderBoxMapper, DeliveryOrderBox> implements IDeliveryOrderBoxService {

    @Override
    public List<DeliveryOrderBox> getByOrderHeaderId(Long orderHeaderId) {
        DeliveryOrderBox q = new DeliveryOrderBox();
        q.setOrderHeaderId(orderHeaderId);
        QueryWrapper<DeliveryOrderBox> queryWrapper = new QueryWrapper<>(q);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public DeliveryOrderBox getByOrderDetailIdAndBoxId(Long orderDetailId, Long boxId) {
        DeliveryOrderBox q = new DeliveryOrderBox();
        q.setOrderDetailId(orderDetailId);
        q.setBoxId(boxId);
        QueryWrapper<DeliveryOrderBox> queryWrapper = new QueryWrapper<>(q);
        return baseMapper.selectOne(queryWrapper);
    }
}
